/**
 * Created by Administrator on 2016/7/5.
 */
"use strict";
swan_pc
    .factory("Task",function($resource){
        return $resource("api/individualTasks",{
            "query":{
                method:"GET"
            },
            "save":{
                method:"POST"
            }
        })
    })
    .factory("TaskById",function($resource){
        return $resource("api/individualTasks/:taskid",{taskid:"@taskid"},{
            "query":{
                method:"GET"
            },
            "delete":{
                method:"DELETE"
            },
            "update":{
                method:"PUT"
            }
        })
    })
    .factory("TaskDateExchange",function(){
        return{
            GMTDateToBj:function(option){
                if(option==null||option=="")
                {
                    return "";
                }
                option=option.toString();
                var taskTime=option.split(" ");
                var monthEnglish=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
                for(var i=0;i<monthEnglish.length;i++){
                    if(taskTime[1]==monthEnglish[i]){
                        var month=i+1;
                    }
                }
                var day=taskTime[2];
                var year=taskTime[3];
                //var resultTime=new Date(year,month,day);
                var resultTime=year+"-"+month+"-"+day;
                resultTime=new Date(resultTime);
                console.log("resultTime:"+resultTime);
                return resultTime;
            }
        }
    })
